package thread;

import static java.lang.Thread.sleep;

//使用lambda 表达式
public class ThreadDemo14 {
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(()->{
            for(int i = 0; i<5; i++) {
                System.out.println("我是一个线程, 正在工作中...");;
                try {
                    sleep(500);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
            System.out.println("t结束");
        });
        t.start();
        t.join();
        System.out.println("t 已经结束了");
    }
}
